import http from '@/utils/http.js'

// 添加购物播
export const addCar = (data) => {
    return http({
        method: 'post',
        url: `/fitasty/api/shoppingCart/addShoppingCart`,
        data
    })
}

// 购车数量
export const getCarNumber = (params) => {
    return http({
        method: 'get',
        url: `/fitasty/api/shoppingCart/cartTotal`,
        params
    })
}
// 自选商品查询
export const getCarList = (params) => {
    return http({
        method: 'get',
        url: `/fitasty/api/shoppingCart/selectCartAddProduct`,
        params
    })
}

// 购物车详情
export const getCarDetail = (params, instance) => {
    return http({
        method: 'get',
        url: `/fitasty/api/shoppingCart/shoppingCartDetail`,
        params,
        app: instance.proxy.loading
    })
}

// 删除购物车
export const deleteCarItem = (params) => {
    return http({
        method: 'DELETE',
        url: `/fitasty/api/shoppingCart/deleteById/${params.id}`,
        params
    })
}

// 获取门店地址
export const getShopLocal = (params) => {
    return http({
        method: 'get',
        url: `/fitasty/api/shoppingCart/address`,
        params
    })
}


// 修改购物车
export const editCar = (data) => {
    return http({
        method: 'post',
        url: `/fitasty/api/shoppingCart/updateShoppingCart`,
        data
    })
}


// 查询是否购买了订餐计划商品 返回 true 则购买
export const isCheck = (params) => {
    return http({
        method: 'get',
        url: `/fitasty/api/shoppingCart/isCheck`,
        params
    })
}


// 商品配送时间、 支付方式 取货方式
export const selectCare = (params) => {
    return http({
        method: 'get',
        url: `/fitasty/api/product/selectCare`,
        params
    })
}
